import axios from "axios";
// axios 配置
axios.defaults.timeout = 30000;
axios.defaults.baseURL = 'https://cnodejs.org/api/v1/'; //这是调用数据接口

// http response 拦截器
axios.interceptors.response.use(
    response => {

        return new Promise((resolve, reject) => {
            resolve(response.data)
        });
    },
    error => {
        var originalRequest = error.config;
        return new Promise((resolve, reject) => {
            reject({"success":false,data:{},msg:"错误"})
        });
    });
    
export default{
    getTopics(params){
        console.log("参数:",params)
        return new Promise((resolue,reject)=>{
            axios.get("topics",{params:params})
            .then(function (response) {
                resolue(response);
            })
        })
    }
}